package com.fr.report;

import com.fr.base.ColumnRow;
import com.fr.base.FCloneable;
import com.fr.base.FRContext;
import com.fr.base.FRFont;
import com.fr.base.Style;
import com.fr.base.background.Background;
import com.fr.base.core.ComparatorUtils;
import com.fr.base.core.FRCoreContext;
import com.fr.base.core.GraphHelper;
import com.fr.base.xml.BaseXMLUtils;
import com.fr.base.xml.XMLPrintWriter;
import com.fr.base.xml.XMLReadable;
import com.fr.base.xml.XMLableReader;
import com.fr.data.condition.Condition;
import com.fr.data.condition.LiteConditionUtils;
import com.fr.report.cellElement.CellPageAttr;
import com.fr.report.cellElement.Formula;
import com.fr.report.core.DynamicValueList;
import com.fr.report.core.PaintUtils;
import com.fr.report.core.ScriptUtils;
import com.fr.report.core.SheetPageGenerator;
import com.fr.report.core.headerfooter.HFElement;
import com.fr.report.io.xml.HFElementXML;
import com.fr.report.io.xml.ReportXMLUtils;
import com.fr.report.io.xml.SynchronizedStyleList;
import com.fr.report.io.xml.SynchronizedVersion;
import com.fr.util.Utils;
import java.awt.FontMetrics;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

public abstract class AbstractReport
  implements Report
{
  protected FineBook fineBook;
  public DynamicValueList rowHeightList_DEC = new DynamicValueList(19, 50);
  public DynamicValueList columnWidthList_DEC = new DynamicValueList(72, 20);
  protected List floatElementList = new ArrayList();
  private CellCase cellcase;
  protected ReportSettings reportSettings = null;
  protected ReportPageAttr reportPageAttr = null;
  protected Hashtable headerHash = new Hashtable();
  protected Hashtable footerHash = new Hashtable();

  public AbstractReport()
  {
    initReportAttributes();
    this.cellcase = new DefaultCellCase();
  }

  protected void initReportAttributes()
  {
    this.reportSettings = new ReportSettings();
  }

  public ReportSettings getReportSettings()
  {
    return this.reportSettings;
  }

  public void setReportSettings(ReportSettings paramReportSettings)
  {
    this.reportSettings = paramReportSettings;
  }

  public ReportPageAttr getReportPageAttr()
  {
    return this.reportPageAttr;
  }

  public void setReportPageAttr(ReportPageAttr paramReportPageAttr)
  {
    this.reportPageAttr = paramReportPageAttr;
  }

  public ReportHF getHeader(int paramInt)
  {
    ReportHF localReportHF = (ReportHF)this.headerHash.get(new Integer(paramInt));
    if ((localReportHF == null) && (paramInt == 0))
    {
      localReportHF = new ReportHF();
      this.headerHash.put(new Integer(paramInt), localReportHF);
    }
    return localReportHF;
  }

  public void setHeader(int paramInt, ReportHF paramReportHF)
  {
    if (paramReportHF == null)
      this.headerHash.remove(new Integer(paramInt));
    else
      this.headerHash.put(new Integer(paramInt), paramReportHF);
  }

  public ReportHF getFooter(int paramInt)
  {
    ReportHF localReportHF = (ReportHF)this.footerHash.get(new Integer(paramInt));
    if ((localReportHF == null) && (paramInt == 0))
    {
      localReportHF = new ReportHF();
      this.footerHash.put(new Integer(paramInt), localReportHF);
    }
    return localReportHF;
  }

  public void setFooter(int paramInt, ReportHF paramReportHF)
  {
    if (paramReportHF == null)
      this.footerHash.remove(new Integer(paramInt));
    else
      this.footerHash.put(new Integer(paramInt), paramReportHF);
  }

  public void addCellElement(CellElement paramCellElement, boolean paramBoolean)
  {
    this.cellcase.add(paramCellElement, paramBoolean);
  }

  public Object getCellValue(int paramInt1, int paramInt2)
  {
    CellElement localCellElement = (CellElement)this.cellcase.get(paramInt1, paramInt2);
    return ((localCellElement != null) ? localCellElement.getValue() : null);
  }

  public void setCellValue(int paramInt1, int paramInt2, Object paramObject)
  {
    CellElement localCellElement = (CellElement)this.cellcase.get(paramInt1, paramInt2);
    if (localCellElement != null)
    {
      localCellElement.setValue(paramObject);
      return;
    }
    this.cellcase.add(new DefaultCellElement(paramInt1, paramInt2, paramObject), true);
  }

  public CellElement getCellElement(int paramInt1, int paramInt2)
  {
    return ((CellElement)this.cellcase.get(paramInt1, paramInt2));
  }

  public boolean removeCellElement(CellElement paramCellElement)
  {
    if (paramCellElement == null)
      return true;
    if (this.cellcase.get(paramCellElement.getColumn(), paramCellElement.getRow()) == paramCellElement)
    {
      this.cellcase.removeCell(paramCellElement.getColumn(), paramCellElement.getRow());
      return true;
    }
    return false;
  }

  public CellElement removeCellElement(int paramInt1, int paramInt2)
  {
    return ((CellElement)this.cellcase.removeCell(paramInt1, paramInt2));
  }

  public void removeAllCellElements()
  {
    this.cellcase.clear();
  }

  public void removeRow(int paramInt)
  {
    this.cellcase.removeRow(paramInt);
    __mod_column_row(new RemoveRowMOD(this, paramInt));
  }

  public void removeColumn(int paramInt)
  {
    this.cellcase.removeColumn(paramInt);
    __mod_column_row(new RemoveColumnMOD(this, paramInt));
  }

  public void insertRow(int paramInt)
  {
    this.cellcase.insertRow(paramInt);
    __mod_column_row(new InsertRowMOD(this, paramInt));
  }

  public void insertColumn(int paramInt)
  {
    this.cellcase.insertColumn(paramInt);
    __mod_column_row(new InsertColumnMOD(this, paramInt));
  }

  public int getColumnCount()
  {
    return this.cellcase.getColumnCount();
  }

  public int getRowCount()
  {
    return this.cellcase.getRowCount();
  }

  public Iterator cellIterator()
  {
    return this.cellcase.cellIterator();
  }

  public Iterator intersect(int paramInt1, int paramInt2, int paramInt3, int paramInt4)
  {
    return this.cellcase.intersect(paramInt1, paramInt2, paramInt3, paramInt4);
  }

  public Iterator getColumn(int paramInt)
  {
    return this.cellcase.getColumn(paramInt);
  }

  public Iterator getRow(int paramInt)
  {
    return this.cellcase.getRow(paramInt);
  }

  public void merge(int paramInt1, int paramInt2, int paramInt3, int paramInt4)
  {
    Object localObject = null;
    for (int i = paramInt1; i <= paramInt2; ++i)
      for (int j = paramInt3; j <= paramInt4; ++j)
      {
        CellElement localCellElement = (CellElement)this.cellcase.get(j, i);
        if (localCellElement != null)
        {
          if (localObject == null)
            localObject = localCellElement;
          this.cellcase.removeCell(localCellElement.getColumn(), localCellElement.getRow());
        }
      }
    if (localObject != null)
    {
      ((CellElement)localObject).setColumn(paramInt3);
      ((CellElement)localObject).setRow(paramInt1);
      ((CellElement)localObject).setColumnSpan(paramInt4 - paramInt3 + 1);
      ((CellElement)localObject).setRowSpan(paramInt2 - paramInt1 + 1);
    }
    else
    {
      localObject = new DefaultCellElement(paramInt3, paramInt1, paramInt4 - paramInt3 + 1, paramInt2 - paramInt1 + 1, null);
    }
    this.cellcase.add((Cell)localObject, true);
  }

  public void recalculateCellCase()
  {
    if (this.cellcase != null)
      this.cellcase.recalculate();
  }

  public void setCellCase(CellCase paramCellCase)
  {
    this.cellcase = paramCellCase;
  }

  protected CellCase getCellCase()
  {
    return this.cellcase;
  }

  public void cacheCellElement(int paramInt1, int paramInt2, boolean paramBoolean)
  {
    this.cellcase.toCache(paramInt1, paramInt2, paramBoolean);
  }

  public void releaseCellElementCache()
  {
    this.cellcase.releaseCache();
  }

  public Object cloneWithoutCellCase()
    throws CloneNotSupportedException
  {
    AbstractReport localAbstractReport = (AbstractReport)super.clone();
    cloneWithoutCellCase4Report(localAbstractReport);
    return localAbstractReport;
  }

  protected void cloneWithoutCellCase4Report(AbstractReport paramAbstractReport)
    throws CloneNotSupportedException
  {
    if (paramAbstractReport == null)
      return;
    paramAbstractReport.rowHeightList_DEC = ((DynamicValueList)this.rowHeightList_DEC.clone());
    paramAbstractReport.columnWidthList_DEC = ((DynamicValueList)this.columnWidthList_DEC.clone());
    List localList = null;
    try
    {
      localList = (List)FRCoreContext.classForName(this.floatElementList.getClass().getName()).newInstance();
    }
    catch (ClassNotFoundException localClassNotFoundException)
    {
      FRContext.getLogger().log(Level.WARNING, localClassNotFoundException.getMessage(), localClassNotFoundException);
    }
    catch (InstantiationException localInstantiationException)
    {
      FRContext.getLogger().log(Level.WARNING, localInstantiationException.getMessage(), localInstantiationException);
    }
    catch (IllegalAccessException localIllegalAccessException)
    {
      FRContext.getLogger().log(Level.WARNING, localIllegalAccessException.getMessage(), localIllegalAccessException);
    }
    if (localList != null)
    {
      int i = this.floatElementList.size();
      for (int j = 0; j < i; ++j)
        localList.add(((FloatElement)this.floatElementList.get(j)).clone());
      paramAbstractReport.floatElementList = localList;
    }
    paramAbstractReport.cellcase = null;
    if (getReportSettings() != null)
      paramAbstractReport.setReportSettings((ReportSettings)getReportSettings().clone());
    if (getReportPageAttr() != null)
      paramAbstractReport.setReportPageAttr((ReportPageAttr)getReportPageAttr().clone());
    Hashtable localHashtable = new Hashtable();
    Enumeration localEnumeration1 = this.headerHash.keys();
    while (localEnumeration1.hasMoreElements())
    {
      localObject1 = localEnumeration1.nextElement();
      localHashtable.put(localObject1, ((ReportHF)this.headerHash.get(localObject1)).clone());
    }
    paramAbstractReport.headerHash = localHashtable;
    Object localObject1 = new Hashtable();
    Enumeration localEnumeration2 = this.footerHash.keys();
    while (localEnumeration2.hasMoreElements())
    {
      Object localObject2 = localEnumeration2.nextElement();
      ((Hashtable)localObject1).put(localObject2, ((ReportHF)this.footerHash.get(localObject2)).clone());
    }
    paramAbstractReport.footerHash = ((Hashtable)localObject1);
  }

  public Object deriveClearReportWithReadOnlyAttr()
    throws CloneNotSupportedException
  {
    AbstractReport localAbstractReport = (AbstractReport)super.clone();
    localAbstractReport.cellcase = new DefaultCellCase();
    localAbstractReport.floatElementList = new ArrayList();
    localAbstractReport.rowHeightList_DEC = new DynamicValueList(19, 50);
    localAbstractReport.columnWidthList_DEC = new DynamicValueList(72, 20);
    return localAbstractReport;
  }

  public FineBook getBook()
  {
    return this.fineBook;
  }

  public PageSet generateReportPageSet(PaperSetting paramPaperSetting)
  {
    return new ArrayPageSet(new SheetPageGenerator(this, paramPaperSetting).getReportPages(), false);
  }

  protected void setBook(FineBook paramFineBook)
  {
    this.fineBook = paramFineBook;
  }

  public void addCellElement(CellElement paramCellElement)
  {
    addCellElement(paramCellElement, true);
  }

  protected Object __mod_column_row(MOD_COLUMN_ROW paramMOD_COLUMN_ROW)
  {
    if ((paramMOD_COLUMN_ROW == null) || (paramMOD_COLUMN_ROW.intercept()))
      return null;
    paramMOD_COLUMN_ROW.mod_cwidth_rheight();
    Iterator localIterator = cellIterator();
    while (localIterator.hasNext())
    {
      CellElement localCellElement = (CellElement)localIterator.next();
      insertChangeCellElement(localCellElement, paramMOD_COLUMN_ROW);
    }
    return paramMOD_COLUMN_ROW;
  }

  protected void insertChangeCellElement(CellElement paramCellElement, MOD_COLUMN_ROW paramMOD_COLUMN_ROW)
  {
    Object localObject = paramCellElement.getValue();
    if (localObject instanceof Formula)
    {
      Formula localFormula = (Formula)localObject;
      localFormula.setContent(paramMOD_COLUMN_ROW.mod_fm_statement(localFormula.getContent().substring(1)));
    }
  }

  public int getRowHeight(int paramInt)
  {
    return this.rowHeightList_DEC.get(paramInt);
  }

  public void setRowHeight(int paramInt1, int paramInt2)
  {
    if (paramInt2 < 0)
      paramInt2 = 0;
    this.rowHeightList_DEC.set(paramInt1, paramInt2);
  }

  public int getColumnWidth(int paramInt)
  {
    return this.columnWidthList_DEC.get(paramInt);
  }

  public void setColumnWidth(int paramInt1, int paramInt2)
  {
    if (paramInt2 < 0)
      paramInt2 = 0;
    this.columnWidthList_DEC.set(paramInt1, paramInt2);
  }

  public void addFloatElement(FloatElement paramFloatElement)
  {
    this.floatElementList.add(paramFloatElement);
  }

  public FloatElement getFloatElement(String paramString)
  {
    int i = this.floatElementList.size();
    for (int j = 0; j < i; ++j)
    {
      FloatElement localFloatElement = (FloatElement)this.floatElementList.get(j);
      if (ComparatorUtils.equals(localFloatElement.getName(), paramString))
        return localFloatElement;
    }
    return null;
  }

  public Iterator floatIterator()
  {
    return this.floatElementList.iterator();
  }

  public FloatElement removeFloatElement(String paramString)
  {
    for (int i = this.floatElementList.size() - 1; i >= 0; --i)
    {
      FloatElement localFloatElement = (FloatElement)this.floatElementList.get(i);
      if (ComparatorUtils.equals(localFloatElement.getName(), paramString))
      {
        this.floatElementList.remove(i);
        return localFloatElement;
      }
    }
    return null;
  }

  public boolean removeFloatElement(FloatElement paramFloatElement)
  {
    int i = this.floatElementList.indexOf(paramFloatElement);
    boolean bool = false;
    if (i >= 0)
      bool = this.floatElementList.remove(paramFloatElement);
    return bool;
  }

  public void removeAllFloatElements()
  {
    this.floatElementList.clear();
  }

  public void bringFloatElementToFront(FloatElement paramFloatElement)
  {
    int i = this.floatElementList.indexOf(paramFloatElement);
    if ((i == -1) || (i == this.floatElementList.size() - 1))
      return;
    this.floatElementList.remove(i);
    this.floatElementList.add(paramFloatElement);
  }

  public void sendFloatElementToBack(FloatElement paramFloatElement)
  {
    int i = this.floatElementList.indexOf(paramFloatElement);
    if ((i == -1) || (i == 0))
      return;
    this.floatElementList.remove(i);
    this.floatElementList.add(0, paramFloatElement);
  }

  public void bringFloatElementForward(FloatElement paramFloatElement)
  {
    int i = this.floatElementList.indexOf(paramFloatElement);
    if ((i == -1) || (i == this.floatElementList.size() - 1))
      return;
    Utils.swap(this.floatElementList, i, i + 1);
  }

  public void sendFloatElementBackward(FloatElement paramFloatElement)
  {
    int i = this.floatElementList.indexOf(paramFloatElement);
    if ((i == -1) || (i == 0))
      return;
    Utils.swap(this.floatElementList, i, i - 1);
  }

  public void shrinkTOFitRowHeightForCellElement(CellElement paramCellElement)
  {
    int i4;
    int i8;
    int i9;
    int i10;
    int i11;
    int i12;
    if (paramCellElement == null)
      return;
    int i = paramCellElement.getRow();
    int j = paramCellElement.getRowSpan();
    int k = this.rowHeightList_DEC.getRangeValue(i, i + j);
    if (k == 0)
      return;
    int l = this.columnWidthList_DEC.getRangeValue(paramCellElement.getColumn(), paramCellElement.getColumn() + paramCellElement.getColumnSpan());
    if (l < 5)
      return;
    int i1 = PaintUtils.analyzeCellElementPreferredHeight(paramCellElement, l);
    if (j == 1)
    {
      if (this.rowHeightList_DEC.get(i) > 0)
        this.rowHeightList_DEC.set(i, Math.max(i1, this.rowHeightList_DEC.get(i)));
    }
    else
    {
      int i2 = i1 - k;
      if (i2 > 0)
      {
        int i3 = i + j - 1;
        i4 = j;
        for (int i5 = i; i5 <= i3; ++i5)
          if (this.rowHeightList_DEC.get(i5) == 0)
            --i4;
        for (i5 = i; i5 <= i3; ++i5)
          if (this.rowHeightList_DEC.get(i5) > 0)
            this.rowHeightList_DEC.set(i5, this.rowHeightList_DEC.get(i5) + i2 / i4);
        i5 = 0;
        for (int i6 = i; (i6 <= i3) && (i5 < i2 % i4); ++i6)
          if (this.rowHeightList_DEC.get(i6) > 0)
          {
            this.rowHeightList_DEC.set(i6, this.rowHeightList_DEC.get(i6) + 1);
            ++i5;
          }
        CellPageAttr localCellPageAttr = paramCellElement.getCellPageAttr();
        Style localStyle = paramCellElement.getStyle();
        if (localStyle == null)
          localStyle = Style.DEFAULT_STYLE;
        int i7 = ((localCellPageAttr != null) && (!(localCellPageAttr.isRepeat()))) ? 1 : 0;
        if ((i7 != 0) && (localStyle.getRotation() == 0) && (localStyle.getVerticalText() == 0) && (localStyle.getTextStyle() == 0) && (i4 != 1))
        {
          FRFont localFRFont = localStyle.getFRFont();
          FontMetrics localFontMetrics = GraphHelper.getFontMetrics(localFRFont);
          i8 = localFontMetrics.getHeight() + localStyle.getLineSpacing();
          i9 = localStyle.getSpacingBefore();
          i10 = 0;
          i11 = 1;
          for (i12 = i; i12 <= i3; ++i12)
            if (this.rowHeightList_DEC.get(i12) > 0)
            {
              i10 = i9;
              if (i11 == i4)
              {
                this.rowHeightList_DEC.set(i12, this.rowHeightList_DEC.get(i12) - i10);
              }
              else
              {
                i9 = (this.rowHeightList_DEC.get(i12) - i10) % i8;
                if (i9 != 0)
                  i9 = i8 - i9;
                this.rowHeightList_DEC.set(i12, this.rowHeightList_DEC.get(i12) + i9 - ((i11 == 1) ? 0 : i10));
              }
              ++i11;
            }
        }
      }
    }
  }

  public void shrinkTOFitColumnWidthForCellElement(CellElement paramCellElement)
  {
    int i3;
    int i4;
    if (paramCellElement == null)
      return;
    int i = paramCellElement.getRow();
    int j = paramCellElement.getRowSpan();
    int k = this.rowHeightList_DEC.getRangeValue(i, i + j);
    int l = this.columnWidthList_DEC.getRangeValue(paramCellElement.getColumn(), paramCellElement.getColumn() + paramCellElement.getColumnSpan());
    if (l == 0)
      return;
    double d1 = PaintUtils.getPreferredWidth(paramCellElement, k);
    if (paramCellElement.getColumnSpan() == 1)
    {
      this.columnWidthList_DEC.set(paramCellElement.getColumn(), (int)Math.max(d1, this.columnWidthList_DEC.get(paramCellElement.getColumn())));
    }
    else
    {
      int i1 = paramCellElement.getColumn() + paramCellElement.getColumnSpan() - 1;
      double d2 = d1 - this.columnWidthList_DEC.getRangeValue(paramCellElement.getColumn(), i1 + 1);
      int i2 = paramCellElement.getColumnSpan();
      for (i3 = paramCellElement.getColumn(); i3 <= i1; ++i3)
        if (this.columnWidthList_DEC.get(i3) == 0)
          --i2;
      if (d2 > 0.0D)
        for (i3 = paramCellElement.getColumn(); i3 <= i1; ++i3)
          if (this.columnWidthList_DEC.get(i3) > 0)
            this.columnWidthList_DEC.set(i3, (int)(this.columnWidthList_DEC.get(i3) + d2 / i2));
      i3 = 0;
      for (i4 = paramCellElement.getColumn(); (i4 <= i1) && (i3 < d2 % i2); ++i4)
        if (this.columnWidthList_DEC.get(i4) > 0)
        {
          this.columnWidthList_DEC.set(i4, this.columnWidthList_DEC.get(i4) + 1);
          ++i3;
        }
    }
  }

  public void readXML(XMLableReader paramXMLableReader)
  {
    if (paramXMLableReader.isChildNode())
    {
      String str1;
      Object localObject;
      String str2 = paramXMLableReader.getTagName();
      if (str2.equals("Version"))
      {
        if ((str1 = paramXMLableReader.getElementValue()) != null)
        {
          localObject = SynchronizedVersion.getSynchronizedVersion(Thread.currentThread());
          ((SynchronizedVersion)localObject).setVersion(Double.parseDouble(str1));
        }
      }
      else if (str2.equals("XMLVersion"))
      {
        if ((str1 = paramXMLableReader.getElementValue()) != null)
        {
          localObject = SynchronizedVersion.getSynchronizedVersion(Thread.currentThread());
          ((SynchronizedVersion)localObject).setXmlVersionByString(str1);
        }
      }
      else if (str2.equals("Header"))
      {
        readReportHF(paramXMLableReader, true);
      }
      else if (str2.equals("Footer"))
      {
        readReportHF(paramXMLableReader, false);
      }
      else if (("ReportSettings".equals(str2)) || ("ReportSetting".equals(str2)))
      {
        localObject = getReportSettings();
        if (localObject == null)
        {
          localObject = new ReportSettings();
          setReportSettings((ReportSettings)localObject);
        }
        paramXMLableReader.readXMLObject((XMLReadable)localObject);
      }
      else if ("ReportPageAttr".equals(str2))
      {
        localObject = new ReportPageAttr();
        paramXMLableReader.readXMLObject((XMLReadable)localObject);
        setReportPageAttr((ReportPageAttr)localObject);
      }
      else if (("StyleList".equals(str2)) || ("CellStyleList".equals(str2)))
      {
        localObject = SynchronizedStyleList.getSynchronizedStyleList(Thread.currentThread());
        paramXMLableReader.readXMLObject(new XMLReadable(this, (SynchronizedStyleList)localObject)
        {
          private final SynchronizedStyleList val$synchronizedStyleList;
          private final AbstractReport this$0;

          public void readXML()
          {
            if (paramXMLableReader.isChildNode())
            {
              String str = paramXMLableReader.getTagName();
              if (("Style".equals(str)) || ("CellStyle".equals(str)))
                this.val$synchronizedStyleList.addStyle(ReportXMLUtils.readFullStyle(paramXMLableReader));
            }
          }
        });
      }
      else if ("CellElementList".equals(str2))
      {
        paramXMLableReader.readXMLObject(new XMLReadable(this)
        {
          private final AbstractReport this$0;

          public void readXML()
          {
            if (paramXMLableReader.isChildNode())
            {
              CellElement localCellElement = this.this$0.createDefaultCellElementCase();
              paramXMLableReader.readXMLObject(localCellElement);
              this.this$0.addCellElement(localCellElement, false);
            }
          }
        });
      }
      else if (str2.equals("RowHeight"))
      {
        this.rowHeightList_DEC = readDynamicValueList(paramXMLableReader);
      }
      else if (str2.equals("ColumnWidth"))
      {
        this.columnWidthList_DEC = readDynamicValueList(paramXMLableReader);
      }
      else if (str2.equals("FloatElementList"))
      {
        ReportXMLUtils.readReportFloatElementList(paramXMLableReader, this);
      }
    }
  }

  protected abstract CellElement createDefaultCellElementCase();

  protected void readReportHF(XMLableReader paramXMLableReader, boolean paramBoolean)
  {
    String str;
    ReportHF localReportHF = new ReportHF();
    if ((str = paramXMLableReader.getAttr("reportPageType")) != null)
      if (paramBoolean)
        setHeader(Integer.parseInt(str), localReportHF);
      else
        setFooter(Integer.parseInt(str), localReportHF);
    else if (paramBoolean)
      setHeader(0, localReportHF);
    else
      setFooter(0, localReportHF);
    if ((str = paramXMLableReader.getAttr("printBackground")) != null)
      localReportHF.setPrintBackground(Boolean.valueOf(str).booleanValue());
    paramXMLableReader.readXMLObject(new XMLReadable(this, localReportHF)
    {
      private final ReportHF val$reportHF;
      private final AbstractReport this$0;

      public void readXML()
      {
        if (paramXMLableReader.isChildNode())
        {
          Object localObject;
          String str = paramXMLableReader.getTagName();
          if (str.equals("LeftList"))
          {
            localObject = this.val$reportHF.getLeftList();
            if (localObject == null)
            {
              localObject = new ArrayList();
              this.val$reportHF.setLeftList((List)localObject);
            }
            ((List)localObject).clear();
            AbstractReport.access$000(this.this$0, (List)localObject, paramXMLableReader);
          }
          else if (str.equals("CenterList"))
          {
            localObject = this.val$reportHF.getCenterList();
            if (localObject == null)
            {
              localObject = new ArrayList();
              this.val$reportHF.setCenterList((List)localObject);
            }
            ((List)localObject).clear();
            AbstractReport.access$000(this.this$0, (List)localObject, paramXMLableReader);
          }
          else if (str.equals("RightList"))
          {
            localObject = this.val$reportHF.getRightList();
            if (localObject == null)
            {
              localObject = new ArrayList();
              this.val$reportHF.setRightList((List)localObject);
            }
            ((List)localObject).clear();
            AbstractReport.access$000(this.this$0, (List)localObject, paramXMLableReader);
          }
          else if (str.equals("Background"))
          {
            this.val$reportHF.setBackground(BaseXMLUtils.readBackground(paramXMLableReader));
          }
        }
      }
    });
  }

  private void readHFElement(List paramList, XMLableReader paramXMLableReader)
  {
    paramXMLableReader.readXMLObject(new XMLReadable(this, paramList)
    {
      private final List val$elemList;
      private final AbstractReport this$0;

      public void readXML()
      {
        if (paramXMLableReader.isChildNode())
        {
          HFElement localHFElement = HFElementXML.readXML(paramXMLableReader);
          if (localHFElement != null)
            this.val$elemList.add(localHFElement);
        }
      }
    });
  }

  private DynamicValueList readDynamicValueList(XMLableReader paramXMLableReader)
  {
    String str;
    String[] arrayOfString;
    int i;
    DynamicValueList localDynamicValueList = null;
    if ((str = paramXMLableReader.getAttr("defaultValue")) != null)
      try
      {
        localDynamicValueList = new DynamicValueList(Integer.parseInt(str));
      }
      catch (NumberFormatException localNumberFormatException)
      {
        localDynamicValueList = new DynamicValueList((int)Double.parseDouble(str));
      }
    if (localDynamicValueList != null)
      if ((str = paramXMLableReader.getElementValue()) != null)
      {
        arrayOfString = Utils.splitString(str, ',');
        for (i = 0; i < arrayOfString.length; ++i)
          if ((arrayOfString[i] != null) && (arrayOfString[i].length() > 0))
            localDynamicValueList.set(i, (int)Double.parseDouble(arrayOfString[i]));
      }
    return localDynamicValueList;
  }

  public void writeXML(XMLPrintWriter paramXMLPrintWriter)
  {
    Object localObject3;
    ReportSettings localReportSettings = getReportSettings();
    if (localReportSettings != null)
      localReportSettings.writeXML(paramXMLPrintWriter);
    ReportPageAttr localReportPageAttr = getReportPageAttr();
    if (localReportPageAttr != null)
    {
      paramXMLPrintWriter.startTAG("ReportPageAttr");
      localReportPageAttr.writeXML(paramXMLPrintWriter);
      paramXMLPrintWriter.end();
    }
    Enumeration localEnumeration = this.headerHash.keys();
    while (localEnumeration.hasMoreElements())
    {
      localObject1 = localEnumeration.nextElement();
      writeHF(paramXMLPrintWriter, (ReportHF)this.headerHash.get(localObject1), true, ((Integer)localObject1).intValue());
    }
    Object localObject1 = this.footerHash.keys();
    while (((Enumeration)localObject1).hasMoreElements())
    {
      Object localObject2 = ((Enumeration)localObject1).nextElement();
      writeHF(paramXMLPrintWriter, (ReportHF)this.footerHash.get(localObject2), false, ((Integer)localObject2).intValue());
    }
    paramXMLPrintWriter.startTAG("RowHeight");
    writeDynamicValueList(paramXMLPrintWriter, this.rowHeightList_DEC);
    paramXMLPrintWriter.end();
    paramXMLPrintWriter.startTAG("ColumnWidth");
    writeDynamicValueList(paramXMLPrintWriter, this.columnWidthList_DEC);
    paramXMLPrintWriter.end();
    int i = this.floatElementList.size();
    if (i > 0)
    {
      paramXMLPrintWriter.startTAG("FloatElementList");
      for (int j = 0; j < i; ++j)
      {
        localObject3 = (FloatElement)this.floatElementList.get(j);
        ReportXMLUtils.writeFloatElement(paramXMLPrintWriter, (FloatElement)localObject3);
      }
      paramXMLPrintWriter.end();
    }
    paramXMLPrintWriter.startTAG("CellElementList");
    Iterator localIterator = this.cellcase.cellIterator();
    while (localIterator.hasNext())
    {
      localObject3 = (CellElement)localIterator.next();
      ReportXMLUtils.writeCellElement(paramXMLPrintWriter, (CellElement)localObject3);
    }
    paramXMLPrintWriter.end();
  }

  private void writeHF(XMLPrintWriter paramXMLPrintWriter, ReportHF paramReportHF, boolean paramBoolean, int paramInt)
  {
    if (paramBoolean)
      paramXMLPrintWriter.startTAG("Header");
    else
      paramXMLPrintWriter.startTAG("Footer");
    paramXMLPrintWriter.attr("reportPageType", paramInt);
    if (!(paramReportHF.isPrintBackground()))
      paramXMLPrintWriter.attr("printBackground", paramReportHF.isPrintBackground());
    Background localBackground = paramReportHF.getBackground();
    BaseXMLUtils.writeBackground(paramXMLPrintWriter, localBackground);
    List localList1 = paramReportHF.getLeftList();
    if (localList1 != null)
      writeHFElementList(paramXMLPrintWriter, localList1, "LeftList");
    List localList2 = paramReportHF.getCenterList();
    if (localList2 != null)
      writeHFElementList(paramXMLPrintWriter, localList2, "CenterList");
    List localList3 = paramReportHF.getRightList();
    if (localList3 != null)
      writeHFElementList(paramXMLPrintWriter, localList3, "RightList");
    paramXMLPrintWriter.end();
  }

  private void writeHFElementList(XMLPrintWriter paramXMLPrintWriter, List paramList, String paramString)
  {
    paramXMLPrintWriter.startTAG(paramString);
    for (int i = 0; i < paramList.size(); ++i)
      HFElementXML.writeXML(paramXMLPrintWriter, (HFElement)paramList.get(i));
    paramXMLPrintWriter.end();
  }

  private void writeDynamicValueList(XMLPrintWriter paramXMLPrintWriter, DynamicValueList paramDynamicValueList)
  {
    paramXMLPrintWriter.attr("defaultValue", paramDynamicValueList.getDefaultValue());
    StringBuffer localStringBuffer = new StringBuffer();
    int i = paramDynamicValueList.size();
    for (int j = 0; j <= i; ++j)
    {
      if (j != 0)
        localStringBuffer.append(",");
      localStringBuffer.append(paramDynamicValueList.get(j));
    }
    paramXMLPrintWriter.textNode(localStringBuffer.toString());
  }

  public Object clone()
    throws CloneNotSupportedException
  {
    AbstractReport localAbstractReport = (AbstractReport)super.clone();
    clone4Report(localAbstractReport);
    return localAbstractReport;
  }

  protected Object clone4Report(AbstractReport paramAbstractReport)
    throws CloneNotSupportedException
  {
    cloneWithoutCellCase4Report(paramAbstractReport);
    paramAbstractReport.cellcase = ((CellCase)this.cellcase.clone());
    return paramAbstractReport;
  }

  static void access$000(AbstractReport paramAbstractReport, List paramList, XMLableReader paramXMLableReader)
  {
    paramAbstractReport.readHFElement(paramList, paramXMLableReader);
  }

  private class RemoveRowMOD
    implements AbstractReport.MOD_COLUMN_ROW
  {
    private int rowIndex;
    private final AbstractReport this$0;

    public RemoveRowMOD(, int paramInt)
    {
      this.this$0 = paramAbstractReport;
      this.rowIndex = paramInt;
    }

    public boolean intercept()
    {
      return (this.rowIndex < 0);
    }

    public ColumnRow mod_columnrow()
    {
      if ((paramColumnRow != null) && (paramColumnRow.getRow() > this.rowIndex))
        paramColumnRow = ColumnRow.valueOf(paramColumnRow.getColumn(), paramColumnRow.getRow() - 1);
      return paramColumnRow;
    }

    public void mod_condition()
    {
      LiteConditionUtils.convertLiteConditionWhenRemoveRow(paramCondition, this.rowIndex);
    }

    public void mod_cwidth_rheight()
    {
      this.this$0.rowHeightList_DEC.remove(this.rowIndex);
    }

    public String mod_fm_statement()
    {
      return ScriptUtils.moveRow(paramString, this.rowIndex, -1);
    }
  }

  private class RemoveColumnMOD
    implements AbstractReport.MOD_COLUMN_ROW
  {
    private int columnIndex;
    private final AbstractReport this$0;

    public RemoveColumnMOD(, int paramInt)
    {
      this.this$0 = paramAbstractReport;
      this.columnIndex = paramInt;
    }

    public boolean intercept()
    {
      return (this.columnIndex < 0);
    }

    public ColumnRow mod_columnrow()
    {
      if ((paramColumnRow != null) && (paramColumnRow.getColumn() > this.columnIndex))
        paramColumnRow = ColumnRow.valueOf(paramColumnRow.getColumn() - 1, paramColumnRow.getRow());
      return paramColumnRow;
    }

    public void mod_condition()
    {
      LiteConditionUtils.convertLiteConditionWhenRemoveCol(paramCondition, this.columnIndex);
    }

    public void mod_cwidth_rheight()
    {
      this.this$0.columnWidthList_DEC.remove(this.columnIndex);
    }

    public String mod_fm_statement()
    {
      return ScriptUtils.moveColumn(paramString, this.columnIndex, -1);
    }
  }

  private class InsertRowMOD
    implements AbstractReport.MOD_COLUMN_ROW
  {
    private int rowIndex;
    private final AbstractReport this$0;

    public InsertRowMOD(, int paramInt)
    {
      this.this$0 = paramAbstractReport;
      this.rowIndex = paramInt;
    }

    public boolean intercept()
    {
      return (this.rowIndex < 0);
    }

    public ColumnRow mod_columnrow()
    {
      if ((paramColumnRow != null) && (paramColumnRow.getRow() >= this.rowIndex))
        paramColumnRow = ColumnRow.valueOf(paramColumnRow.getColumn(), paramColumnRow.getRow() + 1);
      return paramColumnRow;
    }

    public void mod_condition()
    {
      LiteConditionUtils.convertLiteConditionWhenInsertRow(paramCondition, this.rowIndex);
    }

    public void mod_cwidth_rheight()
    {
      this.this$0.rowHeightList_DEC.insert(this.rowIndex);
    }

    public String mod_fm_statement()
    {
      return ScriptUtils.moveRow(paramString, this.rowIndex, 1);
    }
  }

  private class InsertColumnMOD
    implements AbstractReport.MOD_COLUMN_ROW
  {
    private int columnIndex;
    private final AbstractReport this$0;

    public InsertColumnMOD(, int paramInt)
    {
      this.this$0 = paramAbstractReport;
      this.columnIndex = paramInt;
    }

    public boolean intercept()
    {
      return (this.columnIndex < 0);
    }

    public ColumnRow mod_columnrow()
    {
      if ((paramColumnRow != null) && (paramColumnRow.getColumn() >= this.columnIndex))
        paramColumnRow = ColumnRow.valueOf(paramColumnRow.getColumn() + 1, paramColumnRow.getRow());
      return paramColumnRow;
    }

    public void mod_condition()
    {
      LiteConditionUtils.convertLiteConditionWhenInsertCol(paramCondition, this.columnIndex);
    }

    public void mod_cwidth_rheight()
    {
      this.this$0.columnWidthList_DEC.insert(this.columnIndex);
    }

    public String mod_fm_statement()
    {
      return ScriptUtils.moveColumn(paramString, this.columnIndex, 1);
    }
  }

  protected static abstract interface MOD_COLUMN_ROW
  {
    public abstract boolean intercept();

    public abstract void mod_cwidth_rheight();

    public abstract String mod_fm_statement(String paramString);

    public abstract ColumnRow mod_columnrow(ColumnRow paramColumnRow);

    public abstract void mod_condition(Condition paramCondition);
  }
}